a = 'aaaa'


def test_method():
    a = 'bbbb'
    def test1():
        # nonlocal  修改作用域  使用上一层作用域
        nonlocal a
        a = 'cccc'
        print(a)

    test1()
    print(a)




if __name__ == '__main__':
    print(a)
    test_method()
    print(a)